package galleryviewer;

import javafx.scene.*;
import javafx.scene.paint.Color;
import javafx.scene.text.*;
import javafx.scene.Group;
import javafx.scene.shape.Shape;
import galleryviewer.data.*;
import javafx.scene.image.*;
import javafx.scene.input.MouseEvent;
import javafx.scene.transform.Transform;
import javafx.scene.layout.*;
import javafx.animation.*;


/**
 * @author jaccus, m.deluga
 */

package function fadeIn(node:Node) {
	node.opacity = 0.0;
	var fadeTransition = Timeline {
		repeatCount: 1
		autoReverse: false
		keyFrames : [
			KeyFrame {
				time : 500ms
				values : [
					node.opacity => 1.0 tween Interpolator.LINEAR
				]
			}
		]
	};
	fadeTransition.play();
}

package function fadeOut(node:Node) {
	var fadeOut = Timeline {
		repeatCount: 1
		autoReverse: false
		keyFrames : [
			KeyFrame {
				time : 500ms
				values : [
					node.opacity => 0.0 tween Interpolator.LINEAR
				]
				action: function() {
				    println("removing node {node} from {node.parent}");
					delete node from (node.parent as Group).content;
				}
			}
		]
	};
	fadeOut.play();
}

